package router

import (
	global "yundata-service/internal"
	customer "yundata-service/pkg/api/customer"

	"github.com/gin-gonic/gin"
)

func InitMemberRouter(e *gin.Engine) {
	e.Use(CheckToken())

	memberAction := customer.MemberAction{}
	memberAction.ActionModel = global.ActionModel{}    // Remove the '&' before global.ActionModel
	e.Use(ActionMiddleware(&memberAction.ActionModel)) // Pass the address of memberAction.ActionModel

	visitAction := &customer.VisitAction{}
	visitAction.ActionModel = global.ActionModel{}    // Remove the '&' before global.ActionModel
	e.Use(ActionMiddleware(&visitAction.ActionModel)) // Pass the address of visitAction.ActionModel

	// 客资模块
	memberRouterGroup := e.Group("/api/member", func(ctx *gin.Context) {})
	{
		// 我的客资
		memberRouterGroup.POST("/mine", func(ctx *gin.Context) {
			memberAction.GetMemberList()
		})

		// 客资回访记录
		memberRouterGroup.POST("/visit", func(ctx *gin.Context) {
			visitAction.GetVisitList()
		})
	}

}
